package com.github.icloudpay.crm.core.rest;

import com.github.wxiaoqi.security.common.rest.BaseController;
import com.github.icloudpay.crm.core.api.ConsumerAction;
import com.github.icloudpay.crm.core.biz.ConsumerBiz;
import com.github.icloudpay.crm.core.entity.Consumer;

import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;



/**
 * 会员信息
 * @author Administrator
 *
 */
@Controller
@RequestMapping("admin/consumer")
public class ConsumerController extends BaseController<ConsumerBiz,Consumer> {

	private static final Logger logger = LoggerFactory.getLogger(ConsumerAction.class);
	@Autowired
	private ConsumerBiz consumerBiz;
	
	
	/**
	 * 查询会员列表
	 * @param param
	 * @return
	 */
	@RequestMapping(value = "/getMemberList",method = RequestMethod.POST)
    @ResponseBody
    public Map<String, Object> queryMemberList(@RequestBody Map<String, Object> param) {
		logger.info("查询会员列表，请求参数：{}"+param);
		Map<String, Object> resMap = consumerBiz.queryMemberList(param);
		logger.info("查询会员列表，响应参数：{}"+resMap);
		return resMap;
	}
	
	/**
	 * 查询会员信息
	 * @param param
	 * @return
	 */
	@RequestMapping(value = "/getMemberInfo",method = RequestMethod.POST)
    @ResponseBody
    public Map<String, Object> getMemberInfo(@RequestBody Map<String, Object> param) {
		logger.info("查询会员信息，请求参数：{}"+param);
		Map<String, Object> resMap = consumerBiz.queryMemberInfo(param);
		logger.info("查询会员信息，响应参数：{}"+resMap);
		return resMap;
	}
	
	/**
	 * 修改会员状态
	 * @param param
	 * @return
	 */
	@RequestMapping(value = "/updateAccountStatus",method = RequestMethod.POST)
    @ResponseBody
    public Map<String, Object> updateAccountStatus(@RequestBody Map<String, Object> param) {
		logger.info("修改会员信息，请求参数：{}"+param);
		Map<String, Object> resMap = consumerBiz.updateAccountStatus(param);
		logger.info("修改会员信息，响应参数：{}"+resMap);
		return resMap;
	}
	
	/**
	 * 查询会员实名认证记录
	 * @param param
	 * @return
	 */
	@RequestMapping(value = "/queryRealNameRecord",method = RequestMethod.POST)
    @ResponseBody
    public Map<String, Object> queryRealNameRecord(@RequestBody Map<String, Object> param) {
		logger.info("查询会员实名认证记录，请求参数：{}"+param);
		Map<String, Object> resMap = consumerBiz.queryRealNameRecord(param);
		logger.info("查询会员实名认证记录，响应参数：{}"+resMap);
		return resMap;
	}
	
	

	@RequestMapping(value = "/updateVerifyFlag",method = RequestMethod.POST)
    @ResponseBody
    public void updateVerifyFlag(@RequestBody Map<String, Object> param) {
		logger.info("修改实名状态，请求参数：{}"+param);
		Map<String, Object> resMap = consumerBiz.updateVerifyFlag(param);
		logger.info("修改实名状态，响应参数：{}"+resMap);
	}
	
}